package cc.magicjson.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class SchedulingCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        // 从环境中读取 scheduling.enabled 配置，默认为 true
        String enabled = context.getEnvironment().getProperty("scheduling.enabled", "true");
        return Boolean.parseBoolean(enabled);
    }
}
